//用于显示班级详细信息的tabPanel
var classesTabPanel=Ext.create("Ext.tab.Panel",{
	defaults:{
		layout:'fit'
	},
	title:'班级详情',
	items : [ {
		title : '详细信息',
		itemId:'detailForm',
		items : [classesDetailForm]
	}, {
		title : '人员信息',
		itemId:'memberGrid',
		items : [classesMemberGrid]
	} ],
	buttons:[{
		text:'保存',
		itemId:'saveButton',
		listeners:[{
			click:function(){
				classsesDetailSaveClick();
			}
		}]
	}]
});

//用于显示组详细信息的tabPanel
var groupTabPanel=Ext.create("Ext.tab.Panel",{
	title:'组详情',
	defaults:{
		layout:'fit'
	},
	items : [ {
		title : '详细信息',
		itemId:'detailForm',
		items : [groupDetailForm]
	}, {
		title : '人员信息',
		itemId:'memberGrid',
		items : [groupMemberGrid]
	} ],
	buttons:[{
		text:'保存',
		itemId:'saveButton',
		listeners:[{
			click:function(){
				classesGroupSave();
			}
		}]
	}]
});

//用于显示复制测试需求信息的TabPanel
var classesCopyReqTabPanel=Ext.create("Ext.tab.Panel",{
	defaults:{
		layout:'fit'
	},
	title:'测试需求详情',
	items : [ {
		title : '详细信息',
		itemId:'detailForm',
		items : [classesCopyReqDetailForm]
	}, {
		title : '审核记录',
		itemId:'checkLogGrid',
		items : [testReqCopyCheckLogGrid]
	} ],
	listeners:[{
		tabchange:function( tabPanel, newCard, oldCard, eOpts){
			if(newCard.title=='审核记录'){
				var selectArray = classesLeftTreePanel.getSelectionModel().getSelected();// 得到被选择的行的数组.
				testCopyCheckLogStore.proxy.url = zuulUrl + '/' + testServiceName + '/testProject/copyTrqCheckLog/' + selectArray.items[0].data.id;
				testCopyCheckLogStore.reload();
			}
		}
	}],
	dockedItems: [{
	    xtype: 'toolbar',
	    dock: 'bottom',
	    itemId:'dockedItems',
	    ui: 'footer',
	    items: [{ xtype: 'component', flex: 1 },
	        {
                xtype: 'numberfield',
                labelWidth: 30,
                fieldLabel: '评分',
                allowBlank: false,
                itemId:'grade',
                value: 0,
                maxValue: 100,
                minValue: 0
            },{ 
            	xtype: 'button',
            	width:70,
            	text: '确认',
            	listeners:[{
            		click:function(){
            			var selectArray = classesLeftTreePanel.getSelectionModel().getSelected();// 得到被选择的行的数组.
            			var id=selectArray.items[0].data.id;
            			var grade=classesCopyReqTabPanel.down('#grade').getValue();
            			gradeCopyItem(0,id,grade);
            		}
            	}]
            }
	    ]
	}]
});

//显示审核测试需求、计划、执行的复制审核记录的批注
var testCopyCheckAnnotatePanel = Ext.create('Ext.panel.Panel', {
    header: false
});

//用于显示复制测试计划四个板块的tabPanel
var testDesignCopyTabPanel = Ext.create('Ext.tab.Panel', {
	defaults:{
		layout:'fit'
	},
	items : [ {
		title : '详细信息',
		itemId:'detailForm',
		items : [ testDesignCopyDetailForm]
	}, {
		title : '测试步骤',
		itemId:'stepGrid',
		items : [testDesignCopyStepGrid]
	}, {
		title : '需求范围',
		itemId:'designCoverReqGrid',
		items : [testDesignTestRequirementCopyGrid ]
	}, {
		title : '审核记录',
		itemId:'checkLogGrid',
		items : [testDesignCheckLogCopyGrid]
	} ],
	listeners:[{
		tabchange:function( tabPanel, newCard, oldCard, eOpts){
			if(newCard.title=='审核记录'){
				var selectArray = classesLeftTreePanel.getSelectionModel().getSelected();// 得到被选择的行的数组.
				testCopyCheckLogStore.proxy.url = zuulUrl + '/' + testServiceName + '/testProject/copyDesignCheckLog/' + selectArray.items[0].data.id;
				testCopyCheckLogStore.reload();
			}
		}
	}],
	dockedItems: [{
	    xtype: 'toolbar',
	    dock: 'bottom',
	    itemId:'dockedItems',
	    ui: 'footer',
	    items: [{ xtype: 'component', flex: 1 },
	        {
                xtype: 'numberfield',
                labelWidth: 30,
                fieldLabel: '评分',
                allowBlank: false,
                itemId:'grade',
                value: 0,
                maxValue: 100,
                minValue: 0
            },{ 
            	xtype: 'button',
            	width:70,
            	text: '确认',
            	listeners:[{
            		click:function(){
            			var selectArray = classesLeftTreePanel.getSelectionModel().getSelected();// 得到被选择的行的数组.
            			var id=selectArray.items[0].data.id;
            			var grade=testDesignCopyTabPanel.down('#grade').getValue();
            			gradeCopyItem(1,id,grade);
            		}
            	}]
            }
	    ]
	}]
});

//用于显示复制测试执行记录的panel(里面装填了两个grid)
var testRunLogCopyPanel = Ext.create('Ext.panel.Panel', {
//	height : 490,
//	maxHeight : 490,
	header : false,
	layout : {
		type : 'vbox',// 子容器垂直排列
		align : 'stretch'// 将子项目水平拉伸以填充容器的宽度
	},
	items : [ testRunCopyLogGrid, testRunLogCopyStepGrid ]
});

//用于显示复制测试执行的详细信息Tab
var testRunCopyTabPanel = Ext.create('Ext.tab.Panel', {
	defaults:{
		layout:'fit'
	},
	items : [ {
		title : '详细信息',
		items : [testRunCopyDetailForm]
	}, {
		title : '执行记录',
		itemId:'testRunCheckLogGrid',
		items : [testRunLogCopyPanel]
	}, {
		title : '审核记录',
		itemId:'checkLogGrid',
		items : [testRunCheckLogCopyGrid]
	} ],
	listeners:[{
		tabchange:function( tabPanel, newCard, oldCard, eOpts){
			if(newCard.title=='审核记录'){
				var selectArray = classesLeftTreePanel.getSelectionModel().getSelected();// 得到被选择的行的数组.
				testCopyCheckLogStore.proxy.url = zuulUrl + '/' + testServiceName + '/testProject/copyRunCheckLog/' + selectArray.items[0].data.id;
				testCopyCheckLogStore.reload();
			}
		}
	}],
	dockedItems: [{
	    xtype: 'toolbar',
	    dock: 'bottom',
	    itemId:'dockedItems',
	    ui: 'footer',
	    items: [{ xtype: 'component', flex: 1 },
	        {
                xtype: 'numberfield',
                labelWidth: 30,
                fieldLabel: '评分',
                allowBlank: false,
                itemId:'grade',
                value: 0,
                maxValue: 100,
                minValue: 0
            },{ 
            	xtype: 'button',
            	width:70,
            	text: '确认',
            	listeners:[{
            		click:function(){
            			var selectArray = classesLeftTreePanel.getSelectionModel().getSelected();// 得到被选择的行的数组.
            			var id=selectArray.items[0].data.id;
            			var grade=testRunCopyTabPanel.down('#grade').getValue();
            			gradeCopyItem(2,id,grade);
            		}
            	}]
            }
	    ]
	}]
});


